/**
 * Copyright (C), 2015-2020, XXX有限公司
 * FileName: IssuePolicyIfCodeFactory
 * Author:   ThinkPad
 * Date:     2020/6/30 15:10
 * Description: 工厂（教保网所有的出单ifCode）
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.jt.www.queue.process;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author xq.wu
 * @Description教保网所有的出单ifCode
 * @create 2020/6/30
 * @since 1.0.0
 */
public class IssuePolicyIfCodeFactory {

    public static final Logger log = LoggerFactory.getLogger(IssuePolicyIfCodeFactory.class);


    private static Map<String, ElecPolicyProcessAbstract> services = new ConcurrentHashMap<String, ElecPolicyProcessAbstract>();

    public static ElecPolicyProcessAbstract getProcess(String ifCode) {
        return services.get(ifCode);
    }

    /**
     * 项目启动默认会加载配置
     *
     * @param ifCode
     * @param elecPolicyProcess
     */
    public static void register(String ifCode, ElecPolicyProcessAbstract elecPolicyProcess) {
        Assert.notNull(ifCode, "ifCode can't be null");
        services.put(ifCode, elecPolicyProcess);
    }
}